package com.ag.dgm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbAdviceWay;
import com.ag.common.AgException;
import com.ag.common.IDServiceImpl;
import com.ag.common.IDUtil;
import com.ag.dgm.dao.TbAdviceWayDAO;
import com.ag.dgm.service.IAdviceWayService;

@Service("adviceWayServiceImpl")
public class AdviceWayServiceImpl implements IAdviceWayService {


	@Resource(name="iDServiceImpl")
	private IDServiceImpl idService;
	
	@Resource(name="DGMtbAdviceWayDAO")
	private TbAdviceWayDAO dao;
	
	@Override
	public void add(TbAdviceWay tbAdviceWay) {
		String IDs = null;
		try {
			IDs = idService.findTablePK(IDUtil.TB_ADVICE_WAY);
		} catch (AgException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		tbAdviceWay.setAwId(IDs);
		dao.save(tbAdviceWay);
		
	}

	@Override
	public void delete(TbAdviceWay tbAdviceWay) {
		dao.delete(tbAdviceWay);
		
	}

	@Override
	public List<TbAdviceWay> findAll() {
		return dao.findAll();
	}

	@Override
	public void modify(TbAdviceWay tbAdviceWay) {
		tbAdviceWay.setA(IDUtil.PRESERVE);
		dao.attachDirty(tbAdviceWay);
		
	}

}
